#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>

using namespace std;

vector<int> buildArray(vector<int>& nums) {
    int n = nums.size();
    vector<int> res(n);
    for (int i = 0; i < n; ++i) {
        res[i] = nums[nums[i]];
    }
    return res;
}

int main() {
    vector<int> nums = { 0,2,1,5,3,4 };
	vector<int> res = buildArray(nums);
    for(auto& x : res)
        cout << x << " ";
};
